@import 'vars';
@import 'mixins';
@import 'functions';

.navigation {
  flex: 0 0 auto;
  transition: background 250ms;
  background: getColor(elephant);
}

.navigation__inner {
  position: relative;
  background: #2b3a42;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 0.6em 1em;

  @include break {
    padding: 0 1.5em;
  }
}

.navigation__mobile {
  display: none;
  fill: white;
  padding: 0;
  margin: 0;
  line-height: 0;
  outline: none;
  border: none;
  cursor: pointer;
  background: transparent;
  transition: color 250ms;
}

.navigation__mobile svg {
  width: 20px;
  height: 20px;
}

.navigation__logo {
  margin: auto;
  text-decoration: none;
  text-transform: uppercase;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: white;
  transition: all 250ms;
}

.navigation__items {
  flex: 1 1 auto;
  display: flex;
  height: 56px;
  align-items: center;
  justify-content: flex-end;
}

.navigation__item {
  position: relative;
  display: inline-block;
  font-size: getFontSize(-1);
  padding-bottom: 0.1em;
  margin-right: 18px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: getColor(white);
  transition: all 250ms;
  @include fontantialias(false);

  &:hover {
    color: getColor(malibu);
  }

  &--icon {
    font-size: 16px;
    margin-top: 2px;
    -webkit-font-smoothing: antialiased;
  }

  &--active {
    color: #fff;

    &:after {
      content: '';
      position: absolute;
      width: 100%;
      height: 3px;
      top: 100%;
      left: 0;
      background: getColor(malibu);
    }
  }

  &--offset {
    margin-right: -1.5em;
  }
}

.navigation-search {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.navigation-search__input {
  font-size: 16px;
  width: 0;
  max-width: calc(100vw - 8.5em);
  padding: 0;
  border: none;
  background: transparent;
  text-indent: 0.5em;
  margin-right: 0;
  color: white;
  text-shadow: 0 0 0 #666;
  transition: all 250ms;

  &::-webkit-input-placeholder {
    color: lighten(getColor(fiord), 15%);
    text-shadow: none;
    -webkit-text-fill-color: initial;
  }
}

.navigation-search__icon {
  font-size: 1em;
  width: 1em;
  height: 1em;
  padding: 0;
  border: none;
  cursor: pointer;
  fill: lightgrey;
  background: transparent;
  transition: color 250ms;
}

.navigation-search__input:focus,
.navigation-search__icon:focus {
  outline: none;
}

.navigation-search__clear {
  display: none;
  margin-bottom: -1px;
}

.navigation-search--active .navigation-search__input {
  margin-right: 0.5em;
  width: 400px;
}

.navigation-search--active .navigation-search__clear {
  display: block;
}

.navigation-search--active .navigation-search__search {
  display: none;
}

.navigation-search__results {
  position: absolute;
  top: 100%;
  right: 0;
  width: 100%;
  margin-top: 5px;
}

.navigation--search .navigation__item {
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap;
  padding: 1.5em 0;
  margin-right: -35px;
  opacity: 0;
}

.navigation-sub {
  display: block;
  background: getColor(concrete);
}

.navigation-sub__inner {
  max-width: map-get($screens, large);
  margin: 0 auto;
  padding: 0 1.5em;
  text-align: right;
}

.navigation-sub__link {
  display: inline-block;
  font-size: 0.8em;
  margin-left: 1.5em;
  padding: 0.4em 0;
  color: $text-color-highlight;
  text-transform: uppercase;
  @include fontantialias(false);

  &:hover {
    color: getColor(malibu);
  }

  &--active {
    color: getColor(mine-shaft);
    font-weight: 600;
  }
}

@media (max-width: 720px) {
  .navigation-sub {
    display: none;
  }
}

@media (max-width: 720px) {
  .navigation__mobile {
    display: block;
  }
  .navigation__items {
    display: none;
  }
  .navigation--search .navigation__logo {
    pointer-events: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    margin-right: -35px;
    letter-spacing: -1em;
    opacity: 0;
  }
}
